//表单需要限制上传中不允许提交需要将这些内容加入到formCenter/index.vue中
export  default {
    data(){
        return {
            uploadingList:[],
            buttonLoading:false
        }
    },
    computed:{
        uploadingListLength(){
            return  this.uploadingList.length
        }
    },
    watch:{
        uploadingListLength(val){
            if(val !== 0 ){
                this.buttonLoading = true
            }else{
                this.buttonLoading = false
            }
        }
    },
    mounted() {
        //监听form-upload的上传事件
        this.$on("uploading", (fileId)=>{
            //上传文件时，将文件id加入到uploadingList中
            this.uploadingList.push(fileId)
        })
        this.$on("uploaded", (fileId)=>{
            //上传成功后,将文件id从uploadingList中移除
            const index = this.uploadingList.indexOf(fileId)
            if(index>-1){
                this.uploadingList.splice(index,1)
            }
        })
    }
}